{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>Company Name</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>成立年份</th>\n",
       "      <th>部分投资机构</th>\n",
       "      <th>region</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>Ant Financial</td>\n",
       "      <td>10000</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>2014</td>\n",
       "      <td>春华资本、中投海外、红杉资本</td>\n",
       "      <td>环杭州湾大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>字节跳动</td>\n",
       "      <td>Bytedance</td>\n",
       "      <td>5000</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>媒体和娱乐</td>\n",
       "      <td>张一鸣</td>\n",
       "      <td>2012</td>\n",
       "      <td>红杉资本、海纳亚洲、纪源资本、启明创投</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>滴滴出行</td>\n",
       "      <td>Didi Chuxing</td>\n",
       "      <td>3600</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>共享经济</td>\n",
       "      <td>程维</td>\n",
       "      <td>2012</td>\n",
       "      <td>腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6</td>\n",
       "      <td>陆金所</td>\n",
       "      <td>Lufax</td>\n",
       "      <td>2700</td>\n",
       "      <td>中国</td>\n",
       "      <td>上海</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>计葵生</td>\n",
       "      <td>2011</td>\n",
       "      <td>摩根士丹利、中银集团、国泰君安（香港）</td>\n",
       "      <td>环杭州湾大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>11</td>\n",
       "      <td>微众银行</td>\n",
       "      <td>WeBank</td>\n",
       "      <td>1500</td>\n",
       "      <td>中国</td>\n",
       "      <td>深圳</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>顾敏</td>\n",
       "      <td>2014</td>\n",
       "      <td>腾讯、华平投资、淡马锡</td>\n",
       "      <td>粤港澳大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>201</th>\n",
       "      <td>264</td>\n",
       "      <td>有利网</td>\n",
       "      <td>Yooli</td>\n",
       "      <td>70</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>金融科技</td>\n",
       "      <td>吴逸然</td>\n",
       "      <td>2012</td>\n",
       "      <td>高瓴资本、晨兴资本、软银中国</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>202</th>\n",
       "      <td>264</td>\n",
       "      <td>网易有道</td>\n",
       "      <td>Youdao</td>\n",
       "      <td>70</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>软件与服务</td>\n",
       "      <td>周枫</td>\n",
       "      <td>2007</td>\n",
       "      <td>君联资本、慕华投资</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>203</th>\n",
       "      <td>264</td>\n",
       "      <td>云鸟科技</td>\n",
       "      <td>Yunniao</td>\n",
       "      <td>70</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>物流</td>\n",
       "      <td>韩毅</td>\n",
       "      <td>2014</td>\n",
       "      <td>华平投资、红杉资本、经纬中国</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>204</th>\n",
       "      <td>264</td>\n",
       "      <td>掌门1对1</td>\n",
       "      <td>Zhangmen</td>\n",
       "      <td>70</td>\n",
       "      <td>中国</td>\n",
       "      <td>上海</td>\n",
       "      <td>教育科技</td>\n",
       "      <td>张翼</td>\n",
       "      <td>2014</td>\n",
       "      <td>顺为资本、达晨创投、华平投资</td>\n",
       "      <td>环杭州湾大湾区</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>205</th>\n",
       "      <td>264</td>\n",
       "      <td>转转</td>\n",
       "      <td>Zhuanzhuan</td>\n",
       "      <td>70</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>电子商务</td>\n",
       "      <td>姚劲波</td>\n",
       "      <td>2015</td>\n",
       "      <td>腾讯</td>\n",
       "      <td>渤海大湾区</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>206 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      排名   企业名称   Company Name  估值（亿人民币）  国家  城市     行业 掌门人/创始人  成立年份  \\\n",
       "0      1   蚂蚁金服  Ant Financial     10000  中国  杭州   金融科技     井贤栋  2014   \n",
       "1      2   字节跳动      Bytedance      5000  中国  北京  媒体和娱乐     张一鸣  2012   \n",
       "2      3   滴滴出行   Didi Chuxing      3600  中国  北京   共享经济      程维  2012   \n",
       "3      6    陆金所          Lufax      2700  中国  上海   金融科技     计葵生  2011   \n",
       "4     11   微众银行         WeBank      1500  中国  深圳   金融科技      顾敏  2014   \n",
       "..   ...    ...            ...       ...  ..  ..    ...     ...   ...   \n",
       "201  264    有利网          Yooli        70  中国  北京   金融科技     吴逸然  2012   \n",
       "202  264   网易有道         Youdao        70  中国  北京  软件与服务      周枫  2007   \n",
       "203  264   云鸟科技        Yunniao        70  中国  北京     物流      韩毅  2014   \n",
       "204  264  掌门1对1       Zhangmen        70  中国  上海   教育科技      张翼  2014   \n",
       "205  264     转转     Zhuanzhuan        70  中国  北京   电子商务     姚劲波  2015   \n",
       "\n",
       "                     部分投资机构   region  \n",
       "0            春华资本、中投海外、红杉资本  环杭州湾大湾区  \n",
       "1       红杉资本、海纳亚洲、纪源资本、启明创投    渤海大湾区  \n",
       "2    腾讯、阿里巴巴、红杉资本、经纬中国、纪源资本    渤海大湾区  \n",
       "3       摩根士丹利、中银集团、国泰君安（香港）  环杭州湾大湾区  \n",
       "4               腾讯、华平投资、淡马锡   粤港澳大湾区  \n",
       "..                      ...      ...  \n",
       "201          高瓴资本、晨兴资本、软银中国    渤海大湾区  \n",
       "202               君联资本、慕华投资    渤海大湾区  \n",
       "203          华平投资、红杉资本、经纬中国    渤海大湾区  \n",
       "204          顺为资本、达晨创投、华平投资  环杭州湾大湾区  \n",
       "205                      腾讯    渤海大湾区  \n",
       "\n",
       "[206 rows x 11 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv (\"F:\\所有作业\\python数据分析\\week13\\pandas-flask\\hurun.tsv\", encoding = \"utf8\", sep=\"\\t\")\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>春华资本</td>\n",
       "      <td>中投海外</td>\n",
       "      <td>红杉资本</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>红杉资本</td>\n",
       "      <td>海纳亚洲</td>\n",
       "      <td>纪源资本</td>\n",
       "      <td>启明创投</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>腾讯</td>\n",
       "      <td>阿里巴巴</td>\n",
       "      <td>红杉资本</td>\n",
       "      <td>经纬中国</td>\n",
       "      <td>纪源资本</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>摩根士丹利</td>\n",
       "      <td>中银集团</td>\n",
       "      <td>国泰君安（香港）</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>腾讯</td>\n",
       "      <td>华平投资</td>\n",
       "      <td>淡马锡</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>201</th>\n",
       "      <td>高瓴资本</td>\n",
       "      <td>晨兴资本</td>\n",
       "      <td>软银中国</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>202</th>\n",
       "      <td>君联资本</td>\n",
       "      <td>慕华投资</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>203</th>\n",
       "      <td>华平投资</td>\n",
       "      <td>红杉资本</td>\n",
       "      <td>经纬中国</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>204</th>\n",
       "      <td>顺为资本</td>\n",
       "      <td>达晨创投</td>\n",
       "      <td>华平投资</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>205</th>\n",
       "      <td>腾讯</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>206 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         0     1         2     3     4     5\n",
       "0     春华资本  中投海外      红杉资本  None  None  None\n",
       "1     红杉资本  海纳亚洲      纪源资本  启明创投  None  None\n",
       "2       腾讯  阿里巴巴      红杉资本  经纬中国  纪源资本  None\n",
       "3    摩根士丹利  中银集团  国泰君安（香港）  None  None  None\n",
       "4       腾讯  华平投资       淡马锡  None  None  None\n",
       "..     ...   ...       ...   ...   ...   ...\n",
       "201   高瓴资本  晨兴资本      软银中国  None  None  None\n",
       "202   君联资本  慕华投资      None  None  None  None\n",
       "203   华平投资  红杉资本      经纬中国  None  None  None\n",
       "204   顺为资本  达晨创投      华平投资  None  None  None\n",
       "205     腾讯  None      None  None  None  None\n",
       "\n",
       "[206 rows x 6 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"部分投资机构\"].str.split('、',expand=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      春华资本\n",
       "0      中投海外\n",
       "0      红杉资本\n",
       "1      红杉资本\n",
       "1      海纳亚洲\n",
       "       ... \n",
       "203    经纬中国\n",
       "204    顺为资本\n",
       "204    达晨创投\n",
       "204    华平投资\n",
       "205      腾讯\n",
       "Name: 投资的公司, Length: 596, dtype: object"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_投资的公司 = df[\"部分投资机构\"].str.split('、', expand=True).stack().reset_index(level=1,drop=True).rename('投资的公司')\n",
    "df_投资的公司"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>序号</th>\n",
       "      <th>投资公司</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>春华资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>中投海外</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>海纳亚洲</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1</td>\n",
       "      <td>纪源资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1</td>\n",
       "      <td>启明创投</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2</td>\n",
       "      <td>腾讯</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2</td>\n",
       "      <td>阿里巴巴</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2</td>\n",
       "      <td>红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2</td>\n",
       "      <td>经纬中国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2</td>\n",
       "      <td>纪源资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>3</td>\n",
       "      <td>摩根士丹利</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>3</td>\n",
       "      <td>中银集团</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>3</td>\n",
       "      <td>国泰君安（香港）</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>4</td>\n",
       "      <td>腾讯</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>4</td>\n",
       "      <td>华平投资</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>4</td>\n",
       "      <td>淡马锡</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>5</td>\n",
       "      <td>GIC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>5</td>\n",
       "      <td>淡马锡</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    序号      投资公司\n",
       "0    0      春华资本\n",
       "1    0      中投海外\n",
       "2    0      红杉资本\n",
       "3    1      红杉资本\n",
       "4    1      海纳亚洲\n",
       "5    1      纪源资本\n",
       "6    1      启明创投\n",
       "7    2        腾讯\n",
       "8    2      阿里巴巴\n",
       "9    2      红杉资本\n",
       "10   2      经纬中国\n",
       "11   2      纪源资本\n",
       "12   3     摩根士丹利\n",
       "13   3      中银集团\n",
       "14   3  国泰君安（香港）\n",
       "15   4        腾讯\n",
       "16   4      华平投资\n",
       "17   4       淡马锡\n",
       "18   5       GIC\n",
       "19   5       淡马锡"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_合并 = {\n",
    "    \"序号\":df_投资的公司.index,\n",
    "    \"投资公司\":df_投资的公司.values\n",
    "}\n",
    "df_合并=pd.DataFrame(dict_合并)\n",
    "df_合并.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       蚂蚁金服\n",
       "1       字节跳动\n",
       "2       滴滴出行\n",
       "3        陆金所\n",
       "4       微众银行\n",
       "       ...  \n",
       "201      有利网\n",
       "202     网易有道\n",
       "203     云鸟科技\n",
       "204    掌门1对1\n",
       "205       转转\n",
       "Name: 企业名称, Length: 206, dtype: object"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_企业名称 = df[\"企业名称\"].str.split('、', expand=True).stack().reset_index(level=1,drop=True).rename('企业名称')\n",
    "df_企业名称"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>序号</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>井贤栋</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>字节跳动</td>\n",
       "      <td>张一鸣</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>滴滴出行</td>\n",
       "      <td>程维</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>陆金所</td>\n",
       "      <td>计葵生</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>微众银行</td>\n",
       "      <td>顾敏</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>201</th>\n",
       "      <td>有利网</td>\n",
       "      <td>吴逸然</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>202</th>\n",
       "      <td>网易有道</td>\n",
       "      <td>周枫</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>203</th>\n",
       "      <td>云鸟科技</td>\n",
       "      <td>韩毅</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>204</th>\n",
       "      <td>掌门1对1</td>\n",
       "      <td>张翼</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>205</th>\n",
       "      <td>转转</td>\n",
       "      <td>姚劲波</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>206 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      企业名称 掌门人/创始人\n",
       "序号                \n",
       "0     蚂蚁金服     井贤栋\n",
       "1     字节跳动     张一鸣\n",
       "2     滴滴出行      程维\n",
       "3      陆金所     计葵生\n",
       "4     微众银行      顾敏\n",
       "..     ...     ...\n",
       "201    有利网     吴逸然\n",
       "202   网易有道      周枫\n",
       "203   云鸟科技      韩毅\n",
       "204  掌门1对1      张翼\n",
       "205     转转     姚劲波\n",
       "\n",
       "[206 rows x 2 columns]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_创始人合并=df[[\"企业名称\",\"掌门人/创始人\"]]\n",
    "df_创始人合并.index.name=\"序号\"\n",
    "df_创始人=pd.merge(df_创始人合并.drop('掌门人/创始人', axis=1),\\\n",
    "                     df['掌门人/创始人'].str.split(',', expand=True).stack().reset_index(level=1,drop=True).rename('掌门人/创始人'),\\\n",
    "                     on=\"序号\")\n",
    "df_创始人"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>序号</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>投资公司</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>春华资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>中投海外</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>蚂蚁金服</td>\n",
       "      <td>井贤栋</td>\n",
       "      <td>红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>字节跳动</td>\n",
       "      <td>张一鸣</td>\n",
       "      <td>红杉资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>字节跳动</td>\n",
       "      <td>张一鸣</td>\n",
       "      <td>海纳亚洲</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>591</th>\n",
       "      <td>203</td>\n",
       "      <td>云鸟科技</td>\n",
       "      <td>韩毅</td>\n",
       "      <td>经纬中国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>592</th>\n",
       "      <td>204</td>\n",
       "      <td>掌门1对1</td>\n",
       "      <td>张翼</td>\n",
       "      <td>顺为资本</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>593</th>\n",
       "      <td>204</td>\n",
       "      <td>掌门1对1</td>\n",
       "      <td>张翼</td>\n",
       "      <td>达晨创投</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>594</th>\n",
       "      <td>204</td>\n",
       "      <td>掌门1对1</td>\n",
       "      <td>张翼</td>\n",
       "      <td>华平投资</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>595</th>\n",
       "      <td>205</td>\n",
       "      <td>转转</td>\n",
       "      <td>姚劲波</td>\n",
       "      <td>腾讯</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>596 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      序号   企业名称 掌门人/创始人  投资公司\n",
       "0      0   蚂蚁金服     井贤栋  春华资本\n",
       "1      0   蚂蚁金服     井贤栋  中投海外\n",
       "2      0   蚂蚁金服     井贤栋  红杉资本\n",
       "3      1   字节跳动     张一鸣  红杉资本\n",
       "4      1   字节跳动     张一鸣  海纳亚洲\n",
       "..   ...    ...     ...   ...\n",
       "591  203   云鸟科技      韩毅  经纬中国\n",
       "592  204  掌门1对1      张翼  顺为资本\n",
       "593  204  掌门1对1      张翼  达晨创投\n",
       "594  204  掌门1对1      张翼  华平投资\n",
       "595  205     转转     姚劲波    腾讯\n",
       "\n",
       "[596 rows x 4 columns]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_投资公司 = pd.merge(df_创始人,df_准备合并,on=\"序号\")\n",
    "df_投资公司"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
